package a.e.b.a;

import a.e.b.b.t;
import a.e.b.c.cb;
import a.e.b.c.o;
import a.j.g;
import a.j.ld;
import a.j.nd;
import org.w3c.dom.NamedNodeMap;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;

import java.awt.*;
import java.net.MalformedURLException;
import java.net.URL;

public class n
  extends i
{
  static Class c;
  public static boolean j;
  
  public String a()
  {
    return "ImageNode";
  }
  
  public String b()
  {
    return "http://www.yworks.com/xml/graphml";
  }
  
  public Class d()
  {
    if (!i.i) {}
    return c == null ? (n.c = b("a.j.nd")) : c;
  }
  
  public void a(ld paramld, cb paramcb, o paramo)
    throws a.e.b.c.a
  {
    boolean bool = i.i;
    super.a(paramld, paramcb, paramo);
    nd localnd = (nd)paramld;
    URL localURL = localnd.i();
    Image localImage = localnd.h();
    paramcb.a("Image", "http://www.yworks.com/xml/graphml");
    if (!bool)
    {
      if (localURL == null)
      {
        if ((bool) || (localImage != null))
        {
          if (bool) {
            break label177;
          }
          if (localImage.getHeight(null) != 0)
          {
            if (bool) {
              break label177;
            }
            if (localImage.getWidth(null) != 0)
            {
              y.a(localImage, paramcb, "refid", paramo);
              if (bool) {
                break label177;
              }
              if (i.h == 0) {}
            }
          }
        }
      }
      else {
        paramcb.c("href", localURL.toString());
      }
    }
    else if ((bool) || (localImage != null))
    {
      if (bool) {
        break label177;
      }
      if (localImage.getHeight(null) != 0)
      {
        if (bool) {
          break label177;
        }
        if (localImage.getWidth(null) != 0) {
          y.a(localImage, paramcb, "refid", paramo);
        }
      }
    }
    if (localnd.e()) {
      label177:
      paramcb.c("alphaImage", "true");
    }
    paramcb.b();
  }
  
  public void a(ld paramld, Node paramNode, t paramt)
    throws a.e.b.b.a
  {
    boolean bool = i.i;
    int k = i.h;
    nd localnd = (nd)paramld;
    super.a(localnd, paramNode, paramt);
    NodeList localNodeList = paramNode.getChildNodes();
    label457:
    label468:
    label617:
    if (localNodeList != null)
    {
      int i = 0;
      label363:
      label628:
      label635:
      do
      {
        if (i >= localNodeList.getLength()) {
          break;
        }
        Node localNode1 = localNodeList.item(i);
        if (!bool)
        {
          if (localNode1.getNodeType() == 1)
          {
            String str1 = localNode1.getLocalName();
            if (bool) {
              continue;
            }
            if ("Image".equals(str1))
            {
              NamedNodeMap localNamedNodeMap = localNode1.getAttributes();
              Image localImage = null;
              Node localNode2 = localNamedNodeMap.getNamedItem("refid");
              if ((localNode2 != null) && (a(paramt))) {
                localImage = y.b(localNode2.getNodeValue(), paramt);
              }
              if (localImage != null)
              {
                localnd.a(localImage);
                if (bool) {
                  break label628;
                }
                if (k == 0) {}
              }
              else
              {
                URL localURL1 = null;
                localNode2 = localNamedNodeMap.getNamedItem("href");
                if (bool) {
                  break label635;
                }
                if (localNode2 != null)
                {
                  try
                  {
                    localURL1 = new URL(localNode2.getNodeValue());
                    localnd.d(localURL1);
                    localImage = localnd.h();
                  }
                  catch (MalformedURLException localMalformedURLException1)
                  {
                    try
                    {
                      URL localURL2 = ((g)paramt.d()).cb();
                      localURL1 = new URL(localURL2, localNode2.getNodeValue());
                      localnd.d(localURL1);
                      localImage = localnd.h();
                    }
                    catch (MalformedURLException localMalformedURLException2)
                    {
                      String str3 = "Cannot load image from external location: " + localMalformedURLException2.getMessage();
                      if (!bool)
                      {
                        if (y.a(paramt, "y.io.graphml.input.DeserializationProperties.IGNORE_RESOURCE_ERRORS")) {
                          a.i.n.a(str3 + ", ignoring Postprocessor");
                        }
                      }
                      else {
                        if (k == 0) {
                          break label363;
                        }
                      }
                      throw new a.e.b.b.a(str3, localMalformedURLException2);
                    }
                  }
                  if (localImage == null)
                  {
                    String str2 = "Cannot load image from: " + localNode2.getNodeValue() + ", trying embedded representation instead";
                    if (!bool)
                    {
                      if (y.a(paramt, "y.io.graphml.input.DeserializationProperties.IGNORE_RESOURCE_ERRORS"))
                      {
                        a.i.n.a(str2 + ", ignoring Postprocessor");
                        if (bool) {
                          break label468;
                        }
                      }
                    }
                    else {
                      if (k == 0) {
                        break label457;
                      }
                    }
                    throw new a.e.b.b.a(str2);
                    localNode2 = localNamedNodeMap.getNamedItem("refid");
                    if (bool) {
                      break label635;
                    }
                    if (localNode2 != null)
                    {
                      localImage = y.b(localNode2.getNodeValue(), paramt);
                      if (!bool)
                      {
                        if (localImage != null)
                        {
                          if ((bool) || (localURL1 != null))
                          {
                            nd.g().put(localURL1, localImage);
                            localnd.d(localURL1);
                            if (bool) {
                              break label628;
                            }
                            if (k == 0) {}
                          }
                          else
                          {
                            localnd.a(localImage);
                            if (bool) {
                              break label628;
                            }
                            if (k == 0) {}
                          }
                        }
                        else {
                          str2 = "Cannot load image from embedded representation";
                        }
                      }
                      else
                      {
                        if (!bool)
                        {
                          if (y.a(paramt, "y.io.graphml.input.DeserializationProperties.IGNORE_RESOURCE_ERRORS"))
                          {
                            a.i.n.a(str2 + ", ignoring Postprocessor");
                            if (bool) {
                              break label628;
                            }
                          }
                        }
                        else {
                          if (k == 0) {
                            break label617;
                          }
                        }
                        throw new a.e.b.b.a(str2);
                      }
                    }
                  }
                }
              }
              localNode2 = localNamedNodeMap.getNamedItem("alphaImage");
              if (bool) {
                continue;
              }
              if (localNode2 != null) {
                localnd.a("true".equalsIgnoreCase(localNode2.getNodeValue()));
              }
            }
          }
          i++;
        }
      } while (k == 0);
    }
  }
  
  private boolean a(t paramt)
  {
    Boolean localBoolean = (Boolean)paramt.a("useEmbeddedResources");
    if (!i.i) {
      if (localBoolean == null) {
        return true;
      }
    }
    return localBoolean.booleanValue();
  }
  
  static Class b(String paramString)
  {
    try
    {
      return Class.forName(paramString);
    }
    catch (ClassNotFoundException localClassNotFoundException)
    {
      throw new NoClassDefFoundError(localClassNotFoundException.getMessage());
    }
  }
}



/* Location:           E:\idea\

 * Qualified Name:     a.e.b.a.n

 * JD-Core Version:    0.7.0.1

 */